fix(ratelimit): no longer stall after rate limit reset - #89
Merged
Conversation
KRaffael
approved these changes
Jul 29, 2026
Contributor
|
🎉 This PR is included in version 0.7.1 🎉 The release is available on GitHub release and as container image |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix: Rate limit stall recovery after reset window expires
Problem
After hitting a GitHub API rate limit, the operator correctly stalled reconciliations but never resumed — even hours after the rate limit reset (which happens every hour).
Root cause: When the rate limit reset time passed,
ShouldStall()still returnedstalled=truewithdelay=0because the cachedRemainingvalue was still below threshold. Since stalling prevented any API calls, therateLimitTrackerTransportnever recorded fresh headers — creating a deadlock.Fix
internal/ratelimit/org_registry.go— InShouldStall(), skip stalling when the reset time (+ grace period) has already passed. The oldRemainingis stale; letting the request through allows the transport to refresh the registry.internal/controller/shared.go— Added a minimum 30s requeue delay (max(time.Until(resetTime), 30s)) as a safety net against tight-looping if aRateLimitedErrorever carries a past reset time.